package crm.view.tree.students;

import java.awt.Color;
import java.awt.Component;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;

import crm.model.teacherPC.connectList.ConnectStudent;



import ch.randelshofer.quaqua.DefaultColumnCellRenderer;
import ch.randelshofer.quaqua.JBrowser;

public class ConnectStudentTreeRender extends DefaultTreeCellRenderer{




	public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
		Component c =  super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
		if (value instanceof ConnectStudent){
			ConnectStudent conS = (ConnectStudent)value;
			if (conS.isConnected()){
				setBackground(Color.GREEN);
			}else {
				setBackground(Color.RED);
			}
		}else {
			setBackground(Color.WHITE);
		}

		return c;
	}

}
